package com.it.flowable.dto;

import lombok.Data;
import org.flowable.bpmn.model.ExtensionAttribute;
import org.flowable.engine.repository.ProcessDefinition;

import java.util.*;

@Data
public class ProcessDefinitionDto {
    private String id;
    private String key;
    private String name;
    private Integer version;
    private String deploymentId;
    private String resourceName;
    private String diagramResourceName;
    private Boolean suspended;

    private Date deploymentTime;

    private Map<String, List<ExtensionAttribute>> attributes;
    // 节点信息
    private List<NodeInfoDto> nodes = new ArrayList<>();

    // 流程变量
    private Map<String, Object> variables = new HashMap<>();

    public ProcessDefinitionDto(ProcessDefinition processDefinition) {
        this.id = processDefinition.getId();
        this.key = processDefinition.getKey();
        this.name = processDefinition.getName();
        this.version = processDefinition.getVersion();
        this.deploymentId = processDefinition.getDeploymentId();
        this.resourceName = processDefinition.getResourceName();
        this.diagramResourceName = processDefinition.getDiagramResourceName();
        this.suspended = processDefinition.isSuspended();
    }

}
